package com.idudiao.sc.neo4j.config;

import org.neo4j.driver.v1.AuthTokens;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.neo4j.Neo4jProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author songyinyin
 * @date 2019/6/5 18:43
 */
@Configuration
public class Neo4jConfig {

    @Autowired
    private Neo4jProperties properties;

    @Bean
    public Driver neo4jDriver() {
        return GraphDatabase.driver(properties.getUri(), AuthTokens.basic(properties.getUsername(), properties.getPassword()));
    }
}
